package CombinationSumIV;

public class Solution {
    public int combinationSum4(int[] nums, int target) {
        int[] f=new int[target+1];
        f[0]=1;
        for (int i=1;i<=target;i++){
        	for (int j=0;j<nums.length;j++)
        		if (nums[j]<=i) f[i]=f[i]+f[i-nums[j]];
        }
        return f[target];
    }   
   public static void main(String args[]){
	   int[] num={1,2,3};
	   int target=4;
	   Solution so=new Solution();
	   System.out.println(so.combinationSum4(num, target));
   }
}
